package com.whiteape.book.ui.adapter;

import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.whiteape.book.R;
import com.whiteape.book.common.WaConstants;
import com.whiteape.book.model.zssq.BookListDetailBean;

import java.util.List;


public class RecommendDetailListAdapter extends BaseQuickAdapter<BookListDetailBean.BooksBean.BookBean, BaseViewHolder> {
    public RecommendDetailListAdapter(int layoutResId, @Nullable List<BookListDetailBean.BooksBean.BookBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, BookListDetailBean.BooksBean.BookBean item) {

        Glide.with(mContext)
                .load(WaConstants.ZSSQ_IMG_BASE_URL + item.getCover())
                .placeholder(R.drawable.ic_default_portrait)
                .error(R.drawable.ic_load_error)
                .fitCenter()
                .into((ImageView) helper.getView(R.id.book_list_info_iv_cover));
        helper.setText(R.id.book_list_info_tv_title, item.getTitle());
        helper.setText(R.id.book_list_info_tv_desc, item.getAuthor());
        helper.setText(R.id.book_list_info_tv_msg,  item.getMinorCate() + "| " + item.getWordCount() / 10000 + "万字");
//        helper.setText(R.id.book_list_info_tv_msg, item.t);
//        helper.setText(R.id.book_brief_tv_msg, getContext().getResources().getString(R.string.booklist_message,
//                value.getBookCount(),value.getCollectorCount()));
        helper.addOnClickListener(R.id.recommend_book_detail);
    }

//    @Override
//    protected void convert(BaseViewHolder helper, BookListDetailSection item) {
//        Glide.with(mContext)
//                .load(AppConstant.ZSSQ_IMG_BASE_URL + item.t.getCover())
//                .placeholder(R.drawable.ic_default_portrait)
//                .error(R.drawable.ic_load_error)
//                .fitCenter()
//                .into((ImageView)helper.getView(R.id.book_list_info_iv_cover));
//        helper.setText(R.id.book_list_info_tv_title, item.t.getTitle());
//        helper.setText(R.id.book_list_info_tv_desc, item.t.getLongIntro());
//        helper.setText(R.id.book_list_info_tv_msg, item.t.getAuthor() + "| " + item.t.getMinorCate() + "|  " + item.t.getWordCount()/10000 + "万字");
////        helper.setText(R.id.book_list_info_tv_msg, item.t);
////        helper.setText(R.id.book_brief_tv_msg, getContext().getResources().getString(R.string.booklist_message,
////                value.getBookCount(),value.getCollectorCount()));
//        helper.addOnClickListener(R.id.recommend_book_detail);
//    }

}
